package cn.xej.miniuiDemo.common;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

@Data
@AllArgsConstructor
@NoArgsConstructor
public class RespObj {

    private int code;
    private String msg;
    private Object data;

    public static RespObj succ(){
        return build(200,"",null);
    }

    public static RespObj succ(int code,Object data){
        return build(code,"",data);
    }

    public static RespObj fail(){
        return build(400,"",null);
    }

    public static RespObj fail(int code,String message,Object data){
        return build(code,message,data);
    }

    public static RespObj build(int code,String msg,Object data){
        RespObj res = new RespObj();
        res.setCode(code);
        res.setMsg(msg);
        res.setData(data);
        return res;
    }

}
